package cn.wolfcode.trip.base.service.impl;

import cn.wolfcode.trip.base.domain.StrategyWishList;
import cn.wolfcode.trip.base.mapper.StrategyWishListMapper;
import cn.wolfcode.trip.base.query.StrategyWishListQueryObject;
import cn.wolfcode.trip.base.service.IStrategyWishListService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class StrategyWishListServiceImpl implements IStrategyWishListService {

    @Autowired
    private StrategyWishListMapper strategyWishListMapper;


    public void savestrategywishList(StrategyWishListQueryObject qo) {
        strategyWishListMapper.insert(qo);
    }

    public Boolean queryforStrategyWishList(StrategyWishListQueryObject qo) {
        StrategyWishList wishList = strategyWishListMapper.selectWishList(qo);
        if(wishList == null){
            //为空就添加进旅行单
            return true;
        }else {
            return false;
        }

    }

    public PageInfo queryforall(StrategyWishListQueryObject qo) {
        PageHelper.startPage(qo.getCurrentPage(), qo.getPageSize());
        List<StrategyWishList> sw = strategyWishListMapper.selectAll(qo);
        return new PageInfo(sw);
    }
}
